using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.PolicyInjection;
using System.Runtime.Remoting.Messaging;
using System.Reflection;

namespace EntLibContrib.PolicyInjection.RemotingInterception
{
    /// <summary>
    /// A class that wraps the outputs of a <see cref="IMethodCallMessage"/> into the
    /// <see cref="IParameterCollection"/> interface.
    /// </summary>
    public class ContextualRemotingOutputParameterCollection : ParameterCollection
    {
        /// <summary>
        /// Constructs a new <see cref="RemotingOutputParameterCollection"/> that wraps the
        /// given method call and arguments.
        /// </summary>
        /// <param name="callMessage">The call message.</param>
        /// <param name="arguments">The arguments.</param>
        public ContextualRemotingOutputParameterCollection(IMethodCallMessage callMessage, object[] arguments)
            : base(arguments, callMessage.MethodBase.GetParameters(),
                delegate(ParameterInfo info) { return info.IsOut; })
        {
        }
    }
}
